<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #demo {
            width: 200px;
            height: 200px;
            background: pink;
            margin-bottom: 5px;
        }
    </style>
</head>
<body>
    <div id="demo"></div>
    <button id="btnwidth">改变宽度</button>
    <button id="btnheight">改变高度</button>
    <button id="btncolor">改变颜色</button>
    <script>
        var demo = document.getElementById("demo");
        var btnwidth = document.getElementById("btnwidth");
        var btnheight = document.getElementById("btnheight");
        var btncolor = document.getElementById("btncolor");
        
        btnwidth.onclick = function(){
            demo.style.width = "400px";
        }
        btnheight.onclick = function(){
            demo.style.height = "400px";
        }
        btncolor.onclick = function(){
            demo.style.backgroundColor = "red";
        }
    </script>
</body>
</html>